# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="root"
__date__ ="$Sep 30, 2009 7:44:22 PM$"

import sql

class Class:

    def __init__(self, teacher, period, classname):

        self.UniqueId = -1
        self.Teacher = teacher
        self.Period = period
        self.ClassName = classname

    def SetId(self, id):
        self.UniqueId = id

    def InsertIntoDatabase(self):

        cursor = sql.conn.cursor()

        cursor.execute("REPLACE INTO ps_classes(`class`,`period`,`teacher`) VALUES('"
            +self.ClassName+"','"+self.Period+"','"+self.Teacher+"')")

        self.SetId( cursor.lastrowid )
        

        




